const proxy = require("http-proxy-middleware");
const bodyparser = require('body-parser');
const axios = require("axios");
const qs = require("qs");
module.exports = function (app) {
    app.get("/test", (req, res) => {
        res.send("ojbk")
    })

    app.use(proxy("/apis", {
        target: "  https://api.juooo.com", //https://cnodejs.org
        changeOrigin: true,
        pathRewrite: {
            "^/apis": ""
        }
    }))
    app.post("/napis", (req, res) => {
        
        axios({
            method: 'get',
            url: "https://api.juooo.com/home/index/getClassifyHome",
            params: {
                "version": " 6.0.3",
                "referer": "2"
            },
            headers: {
                "AUTHORIZATION": "g215vlnrcgqt1197i1h0i3qg26",
                "Origin": "https://m.juooo.com",
                "Referer": "https://m.juooo.com/",
            }
        }).then((rel) => {
            console.log(rel);
            
            res.json(rel.data)
        })


    })


}